/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb.dao.estagio;

import ejb.dao.AbstractFacade;
import java.util.HashMap;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Gomes
 */
@Stateless(mappedName = "ConcedenteFacadeEJB")
public class ConcedenteFacade extends AbstractFacade<Concedente> implements ConcedenteFacadeLocal {

    @PersistenceContext(unitName = "Sigef-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ConcedenteFacade() {
        super(Concedente.class);
    }

    @Override
    public Concedente findCNPJ(String cnpj) {
        Concedente concedente = null;
        HashMap<String, String> par = new HashMap<>();
        par.put("n", cnpj);
        concedente = executeQuerySingleResult("FROM Concedente WHERE cpfcnpj =:n", par);
        return concedente;
    }
}
